package sugar

import "gitee.com/git_public/vfaith/sugar/reflectx"

func GetDefaultArgs[T any](args []T, f ...func() T) T {
	if len(args) > 0 {
		var i interface{} = args[0]
		if i != nil {
			return args[0]
		}
	}
	if len(f) > 0 {
		return f[0]()
	}
	return reflectx.NewInstance[T]()
}
